﻿using System.Collections.Generic;
using System.Web.Mvc;
using Taoke.Services;
using Top.Api.Domain;
using Taoke.Core;
using Web.Models.Taoke;
using System.Text.RegularExpressions;

namespace Nop.Web.Controllers
{
    public class HomeController : BaseNopController
    {
        public ActionResult Index()
        {
            return View();
        }
        public ActionResult Default()
        {
            return View();
        }

        public ActionResult Recommend1()
        {
            var model = new TaokeItemListModel();
            var items = TaoBaoKeService.GetInstance.GetItems(TOPHelper.Categry_Women,null,null,null,null, 0, 8);
            Regex re = new Regex("<[^>]*>");
            foreach (TaobaokeItem item in items)
            {
                TaokeItemModel taokeItemModel = new TaokeItemModel();
                taokeItemModel.NumIid = item.NumIid;
                taokeItemModel.ClickUrl = item.ClickUrl;
                taokeItemModel.PicUrl = item.PicUrl;
                taokeItemModel.Price = item.Price;
                taokeItemModel.CouponPrice = item.CouponPrice;
                taokeItemModel.CouponStartTime = item.CouponStartTime;
                taokeItemModel.CouponEndTime = item.CouponEndTime;
                taokeItemModel.Title = re.Replace(item.Title, "").Replace("%", "");
                taokeItemModel.Volume = item.Volume;
                model.TaokeItems.Add(taokeItemModel);
            }
            return View(model);
        }
    }
}
